﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using BLToolkit.Data;
using Devsoft.DB.Models;

namespace Devsoft.DB.Models.Utils
{
    public class DbModelModule : IHttpModule
    {
        public void Init(HttpApplication context)
        {
            context.EndRequest += new EventHandler(context_EndRequest);
        }

        void context_EndRequest(object sender, EventArgs e)
        {
            var dbManager = DataContextFactory.GetScopedDataContext<DbManager>((Type) null);
            dbManager.Dispose();
        }

        public void Dispose()
        {
            
        }
    }
}
